<?php
// +----------------------------------------------------------------------
// | Copyright © Sogu Technologies Co. Ltd 2018-2050 All rights reserved.
// +----------------------------------------------------------------------
// | File name: ModifyPassRequest.php
// +----------------------------------------------------------------------
// | Author: liuju
// +----------------------------------------------------------------------
// | Description: 描述文档功能
// +----------------------------------------------------------------------
// | Others: 其他内容的说明
// +----------------------------------------------------------------------
// | History: 修改历史记录列表，每条修改记录应包含修改日期、修改者及修改内容简述
// +----------------------------------------------------------------------
// | 1.Date: 2018-12-28 Author: liuju Modification: 创建
// +----------------------------------------------------------------------

namespace App\Http\Requests\Frontend\V10\Users;


use App\Rules\MobileCheck;
use App\Rules\PwdCheck;
use Illuminate\Foundation\Http\FormRequest;

class ModifyPassRequest extends  FormRequest
{

    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }


    public  function  rules()
    {
        return [
            'old_password' =>'nullable',
            'phone_num' => ['bail', 'required', new MobileCheck()],
            'n_password' => ['bail','required',new PwdCheck,'confirmed'],
        ];
    }

    public  function  messages()
    {
        return [
            'phone_num.required' => '手机号码不能为空',
            'n_password.required' => '密码不能为空',
            'n_password.confirmed' => '新密码与确认密码不一致',
        ];
    }


}